package cn.wolfcode.domain;

import cn.wolfcode.enums.AppointmentStatusEnum;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
public class Appointment {
    /** 主键*/
    private Long id;
    /** 预约单流水号*/
    private String ano;
    /** 预约单状态 （预约中/履行中/消费中/归档/废弃单）*/
    private Integer status;
    /** 业务大类*/
    private SystemDictionaryItem category;
    /** 预约说明*/
    private String info;
    /** 联系电话*/
    private String contactTel;
    /** 联系人名称*/
    private String contactName;
    /** 预约门店*/
    private Business business;
    /** 创建时间*/
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date createTime;
    /** 预约时间*/
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JSONField(format = "yyyy-MM-dd HH:mm")
    private Date appointmentTime;

    private String statusName;

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
        this.statusName = AppointmentStatusEnum.findName(status);
    }

    @Override
    public String toString(){
        return JSON.toJSONString(this);
    }
}